package top.jiangqiang.qianyi.common.auth.service;

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import top.jiangqiang.qianyi.common.cache.CacheService;
import top.jiangqiang.qianyi.common.properties.AuthProperties;

@Configuration
public class AuthAutoConfiguration {

    @ConditionalOnMissingBean(AuthService.class)
    @Bean
    AuthService authService(AuthProperties authProperties, CacheService cacheService) {
        return new DefaultAuthServiceImpl(authProperties, cacheService);
    }

    @ConditionalOnMissingBean(UserDetailService.class)
    @Bean
    UserDetailService userDetailService() {
        return new UserDetailService() {
        };
    }
}
